/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tdtest.controls;

import javafx.scene.layout.VBox;
import tdtest.controls.factory.*;
import tdtest.data.*;

/**
 *
 * @author sutter
 */
public class ApplicationControl extends SystemComponentControl<TDApplication> {
	
	private ControlList<TDGroup<TDDataStructure>> dataStructureGroupList;
	private ControlList<TDGroup<TDAction>> actionGroupList;
	private VBox content;
	
	public ApplicationControl(TDApplication application) {
		super(application);
		this.getStyleClass().add("application-control");
		init(application);
	}
	
	private void init(TDApplication application) {
		this.addNameClass("application-name");
		this.addNotesClass("application-notes");
		
		content = new VBox();
		
		dataStructureGroupList = new ControlList<>(application.dataStructures, new GroupControlFactory(new DataStructureControlFactory()));
		dataStructureGroupList.getStyleClass().add("application-data-structure-list");
		dataStructureGroupList.addNameClass("app-data-name");
		content.getChildren().add(dataStructureGroupList);
		
		actionGroupList = new ControlList<>(application.actions, new GroupControlFactory(new ActionControlFactory()));
		actionGroupList.getStyleClass().add("application-action-list");
		actionGroupList.addNameClass("app-actions-name");
		content.getChildren().add(actionGroupList);
		
		content.getStyleClass().add("app-content");
		
		this.setContent(content);
	}
}
